package com.xuetang9.fujian.threaddemo.pasdemo;

import java.util.concurrent.TimeUnit;

/**
 * @author: fujian
 * @description:
 * @date: 2021/5/3 10:59
 * @version: V1.0
 * @package: com.xuetang9.fujian.threaddemo.pasdemo
 **/
public class Producer implements Runnable{
    private CharacterMachine machine = null;

    public Producer(CharacterMachine machine) {
        this.machine = machine;
    }

    @Override
    public void run() {
        System.out.println("生产者开始生产字母");
        while (true){
            try {
                machine.produceChar();
                TimeUnit.MILLISECONDS.sleep(1500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
